<?php echo $this->Session->flash(); ?>

<script>
    $(function() {
        
        $( "#accordion" ).accordion({autoHeight: false});
        $( "#ground" ).tabs();
        $( "#tabs1" ).tabs();
        $( "#valores" ).tabs();
        $( "#accordion" ).accordion( "option", "autoHeight", false );
        $( "#accordion" ).accordion({ collapsible: true });  
        $( "#accordion" ).accordion({ active: false });
        $('#catastral').load('<?php echo $html->url(array('controller' => 'PropertyAppraisals', 'action' => 'catastral_index', $avaluo['Appraisal']['id'])) ?>');
        $('#docs_sum').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'docs_sum_index', $avaluo['Appraisal']['id'])) ?>');
        $('#legal_information').load('<?php echo $html->url(array('controller' => 'PropertyAppraisals', 'action' => 'legal_information', $avaluo['Appraisal']['id'])) ?>');
        $('#sector_description').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'sector_description_index', $avaluo['Appraisal']['id'])) ?>');
        $('#zoning').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'zoning_index', $avaluo['Appraisal']['id'])) ?>');
        $('#campos').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'generals_ground_index', $avaluo['Appraisal']['id'])) ?>');
        $('#lista').load('<?php echo $html->url(array('controller' => 'PropertyAppraisals', 'action' => 'area_index', $avaluo['Appraisal']['id'])) ?>');
        $('#unidades').load('<?php echo $html->url(array('controller' => 'PhysiographicUnits', 'action' => 'index', 1)) ?>');
        $('#cont_caract').load('<?php echo $html->url(array('controller' => 'PropertyAppraisals', 'action' => 'constructions_index')) ?>');
        $('#annexes').load('<?php echo $html->url(array('controller' => 'Properties', 'action' => 'index2')) ?>');
        $('#metodo_avaluo').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'method_index', $avaluo['Appraisal']['id'])) ?>');
        $('#antecedentes').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'backgrounds_index', $avaluo['Appraisal']['id'])) ?>');
        $('#considerations').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'considerations_index', $avaluo['Appraisal']['id'])) ?>');
        $('#economic').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'economic_index', $avaluo['Appraisal']['id'])) ?>');
        $('#val_terreno').load('<?php echo $html->url(array('controller' => 'PhysiographicUnits', 'action' => 'index2')) ?>');
        $('#val_const').load('<?php echo $html->url(array('controller' => 'PropertyAppraisals', 'action' => 'constructions_valor_index')) ?>');
        $('#val_anexos').load('<?php echo $html->url(array('controller' => 'PropertyAppraisals', 'action' => 'annexes_valor_index')) ?>');
        $('#observaciones').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'observations_index', $avaluo['Appraisal']['id'])) ?>',mayuscula());
        $('#aprobation').load('<?php echo $html->url(array('controller' => 'Appraisals', 'action' => 'aprobation_index', $avaluo['Appraisal']['id'])) ?>',mayuscula());
        $("input,textarea").keyup(function(){
            if($(this).attr('id')!='usr'){
                $(this).val($(this).val().toUpperCase());
            }


        });

        $("input[type='submit']").click(function(){
        
            //alert('hola');
            if($(this).attr('class')!='not_hidden'){
                $(this).hide();
                //$(".content").html("<p><img src='/tierimg/loading.gif'/></p>");
    
            }
                    
        

        });    
        
        
        $("#oculto").click(function(){
            $(this).hide();
        });


    });
    
    
    function mayuscula(){
        
        $("input,textarea").keyup(function(){
            if($(this).attr('id')!='usr'){
                $(this).val($(this).val().toUpperCase());
            }


        });
    }
</script>

<h1>AVALUO PROYECTO <?php echo $codigo; ?></h1>


<legend>
    <?php
    if (empty($avaluo)) {

        echo $ajax->link("Agregar avaluo", array('controller' => 'Appraisals', "action" => "add"), array('update' => 'content', 'complete' => 'cargar()', 'id' => 'oculto', 'indicator' => 'loading'));
    } else {
        ?>
    </legend>
<div id="accordion" width="90%">
        <h3><a href="#">I Aspectos Generales</a></h3>
        
        <div>


            <?php if (!empty($avaluo)): ?>

                <table  width="80%" border="1" >
                    <tbody>
                        <tr>
                            <td width="120"><b>Radicación</b></td>
                            <td width="500"><?php echo $avaluo['Appraisal']['radicacion'] ?></td>
                        </tr>   
                        <tr>
                            <td width="120"><b>Fecha radicación</b></td>
                            <td width="500"><?php echo $avaluo['Appraisal']['fecha_radicacion'] ?></td>
                        </tr> 
                        <tr>
                            <td width="120"><b>Tipo inmueble</b></td>
                            <td width="500"><?php echo $avaluo['Appraisal']['tipo_inmueble'] ?></td>
                        </tr>   

                        <tr>
                            <td width="120"><b>Destinación  actual</b></td>
                            <td width="500"><?php echo $avaluo['Appraisal']['destinacion_actual'] ?></td>
                        </tr>   
                        <tr>
                            <td width="120"><b>Plancha IGAC</b></td>
                            <td width="500"><?php echo $avaluo['Appraisal']['plancha_igac'] ?></td>
                        </tr>  
                        <tr>
                            <td width="120"><b>Fecha asignación</b></td>
                            <td width="500"><?php echo $avaluo['Appraisal']['fecha_asignacion'] ?></td>
                        </tr> 
                        <tr>
                            <td width="120"><b>Fecha visita</b></td>
                            <td width="500"><?php echo $avaluo['Appraisal']['fecha_visita'] ?></td>
                        </tr>

                    </tbody>
                </table>

                <?php
                echo $ajax->link("Modificar aspectos generales", array('controller' => 'Appraisals', "action" => "edit", $avaluo['Appraisal']['id']), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading'));
                ?>
            <?php endif; ?>
        </div>
        <h3><a href="#">2. INFORMACION CATASTRAL</a></h3>
        <div id="catastral" >


        </div>

        <h3><a href="#">3. DOCUMENTOS SUMINISTRADOS</a></h3>
        <div id="docs_sum" >


        </div>
        <h3><a href="#">4. TITULACION E INFORMACION JURÍDICA</a></h3>
        <div id="legal_information" >


        </div>
        <h3><a href="#">5. DESCRIPCIÓN GENERAL DEL SECTOR</a></h3>
        <div id="sector_description" >


        </div>

        <h3><a href="#">6. REGLAMENTACIÓN URBANISTICA</a></h3>
        <div id="zoning" >


        </div>
        <h3><a href="#">7. DESCRIPCION DEL INMUEBLE</a></h3>
        <div id="general_description" >
            <div id="ground">
                <ul>
                    <li><a href="#generales">7.1 CARACTERISTICAS GENERALES DEL TERRENO</a></li>
                    <li><a href="#construcciones">7.2 CONSTRUCCIONES</a></li>
                    <li><a href="#annexes">7.3 ANEXOS</a></li>

                </ul> 
                <div id="generales">
                    <div id="tabs1" >
                        <ul>
                            <li><a href="#lista">áreas</a></li>
                            <li><a href="#campos">Aspectos generales</a></li>
                            <li><a href="#unidades">Unidades fisiográficas</a></li>


                        </ul> 
                        <div id="lista">

                        </div>
                        <div id="campos">

                        </div>
                        <div id="unidades">

                        </div>
                    </div>
                </div>
                <div id="construcciones">
                    <div>

                        <div id="cont_caract">

                        </div>
                    </div>
                </div>
                <div id="annexes">
                    dsdsdsdsdsd
                </div>
            </div>

        </div>

        <h3><a href="#">8. MÉTODO DE AVALÚO</a></h3>
        <div id="metodo_avaluo" >


        </div>
        <h3><a href="#">9.ANÁLISIS DE ANTECEDENTES</a></h3>
        <div id="antecedentes" >


        </div>
        <h3><a href="#">10.CONSIDERACIONES GENERALES</a></h3>
        <div id="considerations" >


        </div>
        <h3><a href="#">11. INVESTIGACIÓN ECONÓMICA</a></h3>
        <div id="economic" >


        </div>

        <h3><a href="#">VALORES ADOPTADOS</a></h3>
        <div id="valores" >
            <ul>
                <li><a href="#val_terreno">TERRENO</a></li>
                <li><a href="#val_const"> CONSTRUCCIONES</a></li>
                <li><a href="#val_anexos">ANEXOS</a></li>

            </ul> 
            <div id="val_terreno">

            </div>
            <div id="val_const">

            </div>
            <div id="val_anexos">

            </div>
        </div>
        <h3><a href="#">Observaciones</a></h3>
        <div id="observaciones">


        </div>
        <h3><a href="#">Aprobación</a></h3>
        <div id="aprobation">


        </div>
        <h3><a href="#">CARTA AVALUO</a></h3>
        <div id="" >
            <?php echo $this->Html->link('GENERAR CARTA', array('controller' => 'Appraisals', 'action' => 'print_letter', $avaluo['Appraisal']['id']), array('target' => 'blank')); ?>

        </div>
        

    </div>

    </div>

<?php } ?>

